var { clickUtils } = require("../shizukuUtils/index");
var { timeHelper } = require("../helper");
var pointMap = {
  首页: {
    推荐: [[137, 220, 306, 336], 1080, 2340],
    关注: [[0, 220, 137, 336], 1080, 2340],
    精选: [[306, 220, 443, 336], 1080, 2340],
    首页: [[47, 2176, 168, 2253], 1080, 2340],
    放映厅: [[216, 2165, 432, 2296], 1080, 2340],
    商城: [[648, 2165, 864, 2296], 1080, 2340],
    我的: [[911, 2176, 1032, 2253], 1080, 2340],
  },
};
function refresh() {
  if (timeHelper.possible(1, 20)) {
    clickUtils.clickPointMap(pointMap.首页.精选);
    timeHelper.sleep(10, 20);
  } else {
    clickUtils.clickPointMap(pointMap.首页.我的);
    timeHelper.sleep(3, 6);
  }
  clickUtils.clickPointMap(pointMap.首页.首页);
}
function watch() {
  return timeHelper.sleep(0.5 * 60, 3 * 60);
}

Wang.main = function (max) {
  var max = Number(max || 210);
  var hasRead = 0;
  while (timeHelper.getMin(hasRead) < max) {
    refresh();
    var hasWatch = watch();
    hasRead += hasWatch;
  }
};
